Page({
  data: {
    meals: [
      { id: 1, date: '2024-06-01', menu: '米饭、鸡腿、青菜' },
      { id: 2, date: '2024-06-02', menu: '面条、鸡蛋、胡萝卜' }
    ],
    newDate: '',
    newMenu: '',
    activeTab: 2
  },
  onDateInput(e) {
    this.setData({ newDate: e.detail.value });
  },
  onMenuInput(e) {
    this.setData({ newMenu: e.detail.value });
  },
  addMeal() {
    const { newDate, newMenu, meals } = this.data;
    if (!newDate || !newMenu) return;
    meals.unshift({ id: meals.length + 1, date: newDate, menu: newMenu });
    this.setData({ meals, newDate: '', newMenu: '' });
  }
}); 